<?php
/*
 * class.meattention.php
 * 碎碎念-我关注的人
 * @author samuel
 * @date 2009-06-05
 */
include_once 'class.mytalkBase.php';
class mytalk_meAttention extends mytalkBase {

    function  __construct($core) {
        parent::__construct();
        //参数处理
        $this->step = $this->params['step'] ? strtolower(trim($core->params['step'])) : 'index';
	    $this->user_id = $this->params['uid'] ? (int)$this->params['uid'] : 0;
	    $this->page = $this->params['page'] ? (int)$this->params['page'] : 1;
	    if(!$this->user_id){
		    $this->error = "用户ID不合法！";
		    $this->jumpError();
		    exit;
	    }

        $run = "run_" . $this->step;

        //header("Content-type: text/vnd.wap.wml");
        $this->$run();
    }

    function run_index(){
        //WAP页面
	    //header("Content-type: text/vnd.wap.wml");
	    //TITLE
	    $page_title = "碎碎念-我关注的人";
	    $posturl = $_SERVER['PHP_SELF']."?uid=".$this->user_id."step=talk_do";
	    $content = "";
	    $content .= "<a href='".$_SERVER['PHP_SELF']."?uid=".$this->user_id."'>返回上级</a><br/>";

        $pagesize = 10;
	    $displaypage = 5;
	    $page = $this->page;
	    $current_url = $_SERVER['PHP_SELF']."?act=meAttention&amp;uid=".$this->user_id;

        $meAttentionCount = $this->getuserAttention($this->user_id, '', true);
        $totalPages = ceil($meAttentionCount/$pagesize);
        $pager = $this->core->utility->wap_pager($totalPages, $page, $displaypage, $current_url);
        $arr_limit = array('offset'=>($page-1)*$pagesize, 'pagesize'=>$pagesize);
        $arr_info = $this->getuserAttention($this->user_id, '', false, '', $arr_limit);

        $content .= $pager."<br/>";
        if($arr_info){
            foreach($arr_info as $info){
                $userinfo = $this->core->load('user::userBase')->getInfo(array('table'=>'fun_user', 'primary'=>'UserID'), $info['UserID']);
                $content .= "<a href='./myhome.php?act=userinfo&amp;uid=".$info['UserID']."'>".$userinfo['UserNickName']."</a><br/>";
            }
        }


        $content .= $pager."<br/>";



	    $content .= "<br/>";
	    $content .= "<a href='".$_SERVER['PHP_SELF']."?uid=".$this->user_id."'>返回上级</a><br/>";
	    $content .= "<a href='' alt='建议帮助'>建议帮助</a>";



	    $this->core->tpl->assign('content', $content);
	    $this->core->tpl->assign('page_title', $page_title);
	    $this->core->tpl->display('comm.wml');

    }
}


?>
